<?php
if($user->access!=0){ 
	//gestion des favoris
	if ($_GET['action'] == "remove_favorite_element_ajax" and isset($_GET['id']) and $_GET['dl_txt'] != "1" ){
		$id=mysql_escape_string($_GET['id']);
		$sql_query = mysql_query("SELECT ".DATABASE_TABLE_FAV.".id FROM ".DATABASE_TABLE_FAV." JOIN ".DATABASE_TABLE_FILE." ON ".DATABASE_TABLE_FAV.".fullpath = ".DATABASE_TABLE_FILE.".fullpath WHERE ".DATABASE_TABLE_FILE.".id = $id ");
		while($query=mysql_fetch_array($sql_query)){
			$id2 = $query['id'];
		}
		Fav::remove_favorite_element($id2,$user->login);
		exit;
	}
	elseif ($_GET['action'] == "add_favorite" and isset($_GET['id']) and is_numeric($_GET['id'])){
		Fav::add_favorite($_GET['id'],$user->login);
		exit;
	}
	//Envoi last file && Setcookie avant l'envoi des header
	if($_GET['action']=="ajax" and isset($_GET['sqltype']) and isset($_GET['size'])){
		setcookie('sqltype',mysql_escape_string($_GET['sqltype']), time() + 10*365*24*3600);
		File::ajax_get_last_file($_GET['sqltype'],$_GET['size']);exit();
	}
	//gestion du statu du menu
	if($_GET['action']=="ajax" and isset($_GET['menu_status']) ){
		$user->setMenuStatus($_GET['menu_status']);
	}
	
}
?>